<?php
	include("admin-commons.php");
	
	$sqlConnection = connectToDatabase();
	define(NAME_OF_DB, "hpberry");
	
	echo "<html>Resetting dbs, please wait...</br> ";
	mysql_query("DROP DATABASE ".NAME_OF_DB, $sqlConnection);
		
	// Create database
	if(mysql_query("CREATE DATABASE ".NAME_OF_DB, $sqlConnection))
	{
		echo "Successfully created a new ".NAME_OF_DB."...<br>\n";
		// Select the new database
		mysql_select_db(NAME_OF_DB, $sqlConnection);
	}
	else
	{
		die("Error creating ".NAME_OF_DB.": ".mysql_error());
	}
		
	// Create tables within the new database
	$usersTableCreateQuery = "CREATE TABLE accounts (
		id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
		user TEXT,
		password TEXT
	)";
	
	$createUserQuery = 'INSERT INTO accounts (user, password) VALUES ("admin", "password")';
	
	
	echo "Attempting to create users table...<br>\n";
	mysql_query($usersTableCreateQuery, $sqlConnection);
	echo "Adding default account...<br>\n";
	mysql_query($createUserQuery, $sqlConnection);
	
	// Create tables within the new database
	$usersTableCreateQuery = "CREATE TABLE articles (
		id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
		page TEXT,
		title TEXT,
		image TEXT,
		body TEXT
	)";
	echo "Attempting to create articles table...<br>\n";
	mysql_query($usersTableCreateQuery, $sqlConnection);
	
	/* 4734 Adding articles to database */
	
	echo "Adding articles...</br>";
	/*********************************************/
	$page = "index";
	$title = "Welcome to HPBerry";
	$image = "stuxnet.jpg";
	$body = 'Today\'s new sophisticated threats such as APT bypass anti-virus and other signature-based security 
			solutions every second. Almost 80 percent of malware goes undetected.  At HPBerry, we already know that 
			the adversary will succeed in breaking into your network. Because the intruders are always present, you need a 
			continuous protection product suite that can easily detect, analyze and remediate both known and unknown advanced 
			targeted threats. HPBerry can provide your organization with the necessary tools -- from revolutionary advanced 
			malware detection and analysis solutions to breakthrough incident response technologies  -- to continuously protect 
			your important assets.  Learn more why Fortune 500 corporations, key government agencies, financial institutions, 
			healthcare companies, pharmaceutical organizations and more are using our products.';
	
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/
	$page = "products";
	$title = "Responder";
	$image = "eye.jpg";
	$body = 'Responder is the de-facto standard for physical memory forensics in the industry. 
		     It also offers robust analysis for malware, including low level disassembly and runtime behavior tracing.';
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/
	$page = "products";
	$title = "Digital DNA";
	$image = "eye.jpg";
	$body = "Digital DNA detects malware threats without using signatures. It gives a threat score based on decrypted behaviors. 
			Active Defense can be used with McAfee ePO or stand-alone to reduce incident response costs by thousands of dollars per-machine / per-incident.";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/
	$page = "privacy";
	$title = "Privacy First";
	$image = "eye.jpg";
	$body = "We do not sell, trade, or otherwise transfer to outside parties your personally 
		identifiable information. This does not include trusted third parties who assist us in 
		operating our website, conducting our business, or servicing you, so long as those parties 
		agree to keep this information confidential. We may also release your information when we believe 
		release is appropriate to comply with the law, enforce our site policies, or protect ours or 
		others rights, property, or safety. However, non-personally identifiable visitor information 
		may be provided to other parties for marketing, advertising, or other uses.";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/	
	$page = "contact";
	$title = "Contact HPBerry";
	$image = "eye.jpg";
	$body = "Call today 123-456-7890";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/	
	$page = "jobs";
	$title = "Printer Expert";
	$image = "eye.jpg";
	$body = "We here at HPBerry have been unable to change the toner in our printer for several months.
			We're desprately looking for anyone with experiance in areas such as toner removal,
			toner replacement, general printer maintanance and dust removal.  Must be willing to wear large hats.";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/	
	$page = "jobs";
	$title = "Senoir Programmer";
	$image = "eye.jpg";
	$body = "HPBerry is looking for persons with 3+ months of experiance programming in Visual Basic, or HTML.
			Must be good with kids and clients alike.  Ess-Que-El skill are a plus!";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/
	$page = "testimonials";
	$title = "Chase Shivam";
	$image = "chase.jpg";
	$body = "For years hackers had been owning my MacBook and I could nothing to stop it.  That is until I bought
			HPBerry's Responder.  Now when hackers come calling it takes them 30 or 40 seconds longer to hack me!";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/
	$page = "testimonials";
	$title = "Iggy Krajker";
	$image = "iggy.jpg";
	$body = "I know what you're thinking, how could a man with pink hair know anything about computer security.
			Well I do.  I'm the senoir programmer here at HPBerry and I can tell you with confidence our products
			are the best on the market!  Buy today and I'll accompany you to the mall and help you find a nice hat.";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/
	$page = "testimonials";
	$title = "God";
	$image = "god.jpg";
	$body = "HPBerry's shit is the best yall!  --ROMANS 13:37";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/	
	$page = "press";
	$title = "HPBerry Launches a New Tool";
	$image = "stuxnet.jpg";
	$body = "HPBerry's product suite provides unprecedented host-level and perimeter-level protection against targeted cyber threats. 
		By monitoring both the physical memory and the filesystem, HPBerry provides the most comprehensive host-level view of the 
		enterprise. HPBerry's Digital DNA system can detect unknown threats using automatic reverse engineering and behavioral analysis 
		of physical memory. HPBerry's perimeter appliance, Razor, detects command-and-control and also uses Digital DNA to detect malicious 
		files without signatures. HPBerry's products are designed to save you money by eliminating the need for expensive forensics and 
		drastically reducing cost/time required for incident response.";
	$body = mysql_real_escape_string($body);
	$addArticle = 'INSERT INTO articles (page, title, image, body) VALUES ("'.$page.'", "'.$title.'", "'.$image.'", "'.$body.'")';
	mysql_query($addArticle, $sqlConnection);
	/*********************************************/	
	/* Done */
	echo "Reset Completed!<br>\n</html>";
	mysql_close($sqlConnection);
?>